package com.zj.util;

import java.io.InputStream;
import java.util.Properties;

public class JdbcPropertyLoader {

    private static Properties prop=new Properties();
    private static String driver;
    static{
        try{
            //读取db.properties文件中的数据库连接信息
            InputStream in = JdbcPropertyLoader.class.getClassLoader().getResourceAsStream("jdbc.properties");
            prop.load(in);
            driver = prop.getProperty("jdbc.driver");
            Class.forName(driver);

        }catch (Exception e) {
            System.out.println("加载配置出错");
            e.printStackTrace();
        }
    }

    public static String getProperty(String key){
        return prop.getProperty(key);
    }
}
